{include file="public/header" /}
<link rel="stylesheet" href="__ORG__/validform/css/validform.css">
<script type="text/javascript" src="__ORG__/validform/js/Validform_v5.3.2_min.js"></script>
<link rel="stylesheet" type="text/css" href="__ORG__/uploadify/uploadify.css">
<script src="__ORG__/uploadify/jquery.uploadify.min.js" type="text/javascript"></script>
<style type="text/css">
    .edui-default{line-height: 28px;}
    div.edui-combox-body,div.edui-button-body,div.edui-splitbutton-body
    {overflow: hidden; height:20px;}
    div.edui-box{overflow: hidden; height:22px;}

    .uploadify{display:inline-block;}
    .uploadify-button{border:none; border-radius:5px; margin-top:8px;}
    table.add_tab tr td span.uploadify-button-text{color: #FFF; margin:0;}
</style>
<!--面包屑导航 开始-->
<div class="crumb_warp">
    <!--<i class="fa fa-bell"></i> 欢迎使用登陆网站后台，建站的首选工具。-->
    <i class="fa fa-home"></i> <a href="{:url('admin/index/info')}">首页</a> &raquo; <a href="{:url('admin/lunbo/index')}">轮播管理</a> &raquo; 添加轮播
</div>
<!--面包屑导航 结束-->

<!--结果集标题与导航组件 开始-->
<div class="result_wrap">
    <div class="result_title">
        <h3>轮播管理操作</h3>
        {if isset($error)}
            <div class="mark">
                <p>{$error}</p>
            </div>
        {/if}
    </div>
    <div class="result_content">
        <div class="short_wrap">
            <a href="{:url('admin/lunbo/add')}"><i class="fa fa-plus"></i>添加轮播</a>
            <a href="{:url('admin/lunbo/index')}"><i class="fa fa-recycle"></i>轮播列表</a>
        </div>
    </div>
</div>
<!--结果集标题与导航组件 结束-->

<div class="result_wrap">
    <form action="" method="post" class="demoform">
        <table class="add_tab">
            <tbody>
            <tr>
                <th><i class="require">*</i>轮播图上传：</th>
                <td>
                    <input type="text" class="inputxt" size="50" name="img_url" value="" placeholder="这里面上传轮播图" nullmsg="请上传轮播图">
                    <input type="file" id="file_upload" />
                    <!--<p></p>-->
                </td>
            </tr>
            <tr>
                <th height="auto"></th>
                <td><img id="img_url_img" src="" alt="" style="max-width: 300px; max-height: 100px;"></td>
            </tr>

            <tr>
                <th><i class="require"></i>轮播图链接地址：</th>
                <td>
                    <input type="text" class="lg" name="href" placeholder="这里输入轮播地址">
                    <span></span>
                </td>
            </tr>
            <tr>
                <th><i class="require"></i>轮播描述：</th>
                <td>
                    <input type="text" class="lg" name="tips" placeholder="这里输入轮播描述">
                    <span></span>
                </td>
            </tr>

            <tr>
                <th></th>
                <td>
                    <input type="submit" value="提交">
                    <input type="button" class="back" onclick="history.go(-1)" value="返回">
                </td>
            </tr>
            </tbody>
        </table>
    </form>
</div>
<script type="text/javascript">
    $(function() {
        var url = '{:url("/admin/common/upload/type/lunbo")}';
        $('#file_upload').uploadify({
            'formData'     : {
                'timestamp' : '<?php echo time();?>'
            },
            'buttonText' : '上传图片',
            'swf'      : '__ORG__/uploadify/uploadify.swf',
            'uploader' : url,
            'onUploadError' : function(file, errorCode, errorMsg, errorString) {
                alert('The file ' + file.name + ' could not be uploaded: ' + errorString);
            },
            'onUploadSuccess' : function(file, data, response) {
                var datap = JSON.parse(data); //$.parseJSON(data);
                layer.msg(datap.msg);
                if(datap.errno == 0) {
                    $("input[name='img_url']").val(datap.path);
                    $('#img_url_img').attr('src', datap.path);
                }
            }
        });
    });

    var demo=$(".demoform").Validform({
        tiptype:3,
        label:".label",
        showAllError:true,
        datatype:{
            "zh1-6":/^[\u4E00-\u9FA5\uf900-\ufa2d]{1,6}$/
        },
        ajaxPost:false
    });

    //通过$.Tipmsg扩展默认提示信息;
    //$.Tipmsg.w["zh1-6"]="请输入1到6个中文字符！";
    demo.tipmsg.w["zh1-6"]="请输入1到6个中文字符！";
    demo.tipmsg.w["*2-20"]="轮播标题请输入2到30个字符！";
    demo.tipmsg.w["*3-255"]="轮播轮播图不能为空！";

    demo.addRule([{
            ele:".inputxt:eq(0)",
            datatype:"*3-255"
        }]);

</script>

{include file="public/footer" /}